<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <head th:include="common/common_head :: commonHead('版本表管理')"></head>
</head>
<body class="auth-user">
<div class="layui-fluid">
    <div class="layui-row larryms-panel auth-user-add">
        <form class="layui-form" id="versionForm">
            <input type="hidden" id="id" name="id" th:value="${entity?.id}"/>
            <div class="layui-form-item">
                <label for="clientDeviceType" class="layui-form-label">
                    <span class="x-red">*</span> 客户端设备类型(2 Android/1 IOS)                 </label>
                <div class="layui-input-block">
                        <input type="text" id="clientDeviceType" name="clientDeviceType" lay-verify="clientDeviceType"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.clientDeviceType}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="downloadUrl" class="layui-form-label">
                    <span class="x-red">*</span> 升级下载网址                 </label>
                <div class="layui-input-block">
                        <input type="text" id="downloadUrl" name="downloadUrl" lay-verify="downloadUrl"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.downloadUrl}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="updateInfo" class="layui-form-label">
                    <span class="x-red">*</span> 该升级版本的描述信息                 </label>
                <div class="layui-input-block">
                        <input type="text" id="updateInfo" name="updateInfo" lay-verify="updateInfo"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.updateInfo}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="updateInstall" class="layui-form-label">
                    <span class="x-red">*</span> 是否强制安装 0-否  1-是                 </label>
                <div class="layui-input-block">
                        <input type="text" id="updateInstall" name="updateInstall" lay-verify="updateInstall"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.updateInstall}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="version" class="layui-form-label">
                    <span class="x-red">*</span> 版本号                 </label>
                <div class="layui-input-block">
                        <input type="text" id="version" name="version" lay-verify="version"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.version}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="isOnline" class="layui-form-label">
                    <span class="x-red">*</span> 1 已上线  0 未上线                 </label>
                <div class="layui-input-block">
                        <input type="text" id="isOnline" name="isOnline" lay-verify="isOnline"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.isOnline}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="createTime" class="layui-form-label">
                    <span class="x-red">*</span> 创建时间                 </label>
                <div class="layui-input-block">
                        <input type="text" id="createTime" name="createTime" lay-verify="createTime"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.createTime}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="updateTime" class="layui-form-label">
                    <span class="x-red">*</span> 更新时间                 </label>
                <div class="layui-input-block">
                        <input type="text" id="updateTime" name="updateTime" lay-verify="updateTime"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.updateTime}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="flag" class="layui-form-label">
                    <span class="x-red">*</span> 标记 1-有效 0-无效                 </label>
                <div class="layui-input-block">
                        <input type="text" id="flag" name="flag" lay-verify="flag"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.flag}"/>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="sysuserId" class="layui-form-label">
                    <span class="x-red">*</span> 操作人                 </label>
                <div class="layui-input-block">
                        <input type="text" id="sysuserId" name="sysuserId" lay-verify="sysuserId"
                               autocomplete="off" class="layui-input larry-input" th:value="${entity?.sysuserId}"/>
                </div>
            </div>
    <div th:if="${param.detail == null}">
        <div class="larryms-layer-btn">
            <a class="layui-btn layui-btn layui-btn-sm left" lay-submit=""
               lay-filter="add" id="submit" th:attr="data-url=@{/admin/version/save}">保存</a>
            <a class="layui-btn layui-btn layui-btn-sm  layui-btn-danger" id="resetBtn">重置</a>
            <a class="layui-btn layui-btn layui-btn-sm  layui-btn-primary" id="close">关闭</a>
        </div>
    </div>
    </form>
    </div>
</div>
<script type="text/javascript" th:src="@{/static/larryms/layui/layui.js}"/>
<script type="text/javascript" th:inline="javascript">/*<![CDATA[*/
var bathPath = /*[[@{/}]]*/ "/";
layui.config({
    version: ui.version,
    layertype:2,
    base: bathPath + 'static/larryms/',  //实际使用时，建议改成绝对路径
    rightMenu: "none" // false关闭，设置为custom时使用自定义，不使用默认menu
}).extend({
    larry:'js/base'
}).use(['larry','form','table','laydate','custom'], function () {
    var form = layui.form , larryms = layui.larryms, $ = layui.$, beone = layui.custom;
    var formRules = {};
            formRules.clientDeviceType = function (value) {
                if (value.trim() == "") {
                    return  "客户端设备类型(2 Android/1 IOS)不能为空!" ;
                }
            }
            formRules.downloadUrl = function (value) {
                if (value.trim() == "") {
                    return  "升级下载网址不能为空!" ;
                }
            }
            formRules.updateInfo = function (value) {
                if (value.trim() == "") {
                    return  "该升级版本的描述信息不能为空!" ;
                }
            }
            formRules.updateInstall = function (value) {
                if (value.trim() == "") {
                    return  "是否强制安装 0-否  1-是不能为空!" ;
                }
            }
            formRules.version = function (value) {
                if (value.trim() == "") {
                    return  "版本号不能为空!" ;
                }
            }
            formRules.isOnline = function (value) {
                if (value.trim() == "") {
                    return  "1 已上线  0 未上线不能为空!" ;
                }
            }
            formRules.createTime = function (value) {
                if (value.trim() == "") {
                    return  "创建时间不能为空!" ;
                }
            }
            formRules.updateTime = function (value) {
                if (value.trim() == "") {
                    return  "更新时间不能为空!" ;
                }
            }
            formRules.flag = function (value) {
                if (value.trim() == "") {
                    return  "标记 1-有效 0-无效不能为空!" ;
                }
            }
            formRules.sysuserId = function (value) {
                if (value.trim() == "") {
                    return  "操作人不能为空!" ;
                }
            }
    //自定义验证规则
    form.verify(formRules);

    var indexFre = parent.layer.getFrameIndex(window.name);
    $('#close').click(function () {
        parent.layer.close(indexFre);
    });
    $('#resetBtn').on('click', function() {
        $('#versionForm')[0].reset();
    });
    //监听提交
    form.on('submit(add)', function (data) {
        var url = $(this).data("url");
        $.post(url, data.field, function(res) {
            if (res.code == "success") {
                larryms.msg(res.desc);
                parent.table.reload('versionList', {});
                parent.layer.close(indexFre);
            }
        });
        return false;
    });
    form.render();
});
/*]]>*/</script>
</body>
</html>